package com.qf.service.Impl;

import com.qf.dao.AccountDao;
import com.qf.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author sunyamei
 * @version V1.0
 * @Project spring_demo
 * @Package com.qf.service.Impl
 * @Description:
 * @Date 2022/7/12 10:02
 */
//@Component()
//@Controller()
    @Service
public class AccountServiceImpl  implements AccountService {
        @Autowired
        private AccountDao accountDao;

    public void setAccountDao(AccountDao accountDao) {

        this.accountDao = accountDao;
    }

    //    @Autowired(required = false)
//    @Qualifier("interfaceTestA")
//    @Resource(name = "interfaceTestA")
//    private InterfaceTest interfaceTest;


    @Override
    //@Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED,timeout = -1,readOnly = false,rollbackFor = Exception.class)
    public void transfer(String cardNo, String toCardNo, BigDecimal money) {
        //我卡扣钱
        accountDao.minusUpdate(cardNo,money);
        int i=10/0;
        //对方卡价钱
        accountDao.plusUpdate(toCardNo,money);
    }
}
